import React, { useEffect } from 'react'
import {Navigate,useNavigate} from 'react-router-dom'
// 1.Navigate
/* export default function Redirect(props) {
  return (
        <div>
          <h3>重定向</h3>
          <Navigate to = {props.to}></Navigate>
        </div>
  )
} */

// 2- 自定义重定向
export default function Redirect(props) {
    const navigate = useNavigate();
    useEffect(() => {
        navigate(props.to);
    },[])
  return (
    <div></div>
  )
}
